home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / crt.swg / 0030_Re: Readkey with CRT.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-02-28  |  1.3 KB  |  41 lines

  1. {
  2.  IL>> Will it read the extended function keys?
  3.  
  4.  JS>  Nope, DOS doesn't read functions keys.. But it reads through piped
  5.  JS> commands eg: echo hi | proggy
  6.  
  7. No, let me join this discussion and clear things abit. Actually, DOS *DOSE*
  8. enable reading keyboard including extended keys like F10, Alt-X, cursor-left.
  9. And it even reads F11, F12 keys so why not to use these routines? I am really
  10. wondering, why i have never seen any BBS software that would react specifically
  11. on extended keys, for example on arrow keys? That would allow users to use REAL
  12. menus online! Little ANSI gfx plus extended key reading would be nice, but i
  13. haven't seen any software that enables moving a menu item by pressing the
  14. cursor keys...
  15. Actually, the following is a ReadKey function that i use instead of standard
  16. Crt.ReadKey:
  17. }
  18.  
  19. const
  20.   { sample standard key codes }
  21.   keySpace         = $2000;
  22.   keyEscape        = $1B00;
  23.   { sample extendedd key codes }
  24.   keyAltF1         = $0068;
  25.   keyAltX          = $002D;
  26.  
  27. Function ReadKey : word; assembler;
  28. { Uses function 08h/Int 21h to read from keyboard }
  29. Asm
  30.   mov ah,08h
  31.   int 21h
  32.   xor dl,dl
  33.   mov dh,al
  34.   or  al,0 { extended keystroke? }
  35.   jnz @@1  { no, get out }
  36.   int 21h  { yes, read extended scan code, F11, F12 supported }
  37.   mov dl,al
  38. @@1:
  39.   mov ax,dx
  40. End; { ReadKey }
  41.